Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: More Macintosh Toolbox

Previous | Chapter Top | Chapter Contents | Next |

Finding Components

The Component Manager provides routines that allow your application to search for components. Your application specifies the search criteria in a component description record. (See "Data Structures for Applications," for information about the component description record.) Based on the values you specify in fields of the component description record, the Component Manager attempts to find components that meet the needs of your application.

You can use the CountComponents function to determine the number of components that match a component description. Use the FindNextComponent function to find an individual component that matches a description.

You can use the GetComponentListModSeed function to determine whether the list of registered components has changed.

FindNextComponent

The FindNextComponent function returns the component identifier for the next registered component that meets the selection criteria specified by your application. You specify the selection criteria in a component description record.

Your application can use the component identifier returned by this function to get more information about the component or to open the component.

FUNCTION FindNextComponent (aComponent: Component;
                                          looking: ComponentDescription)
                                          : Component;
aComponent
The starting point for the search. Set this field to 0 to to start the search at the beginning of the component list. If you are continuing a search, you can specify a component identifier previously returned by the FindNextComponent function. The function then searches the remaining components.
looking
A component description record. Your application specifies the criteria for the component search in the fields of this record.
The Component Manager ignores fields in the component description record that are set to 0. For example, if you set all the fields to 0, all components meet the search criteria. In this case, your application can retrieve information about all of the components that are registered in the system by repeatedly calling FindNextComponent and GetComponentInfo until the search is complete. Similarly, if you set all fields to 0 except for the componentManufacturer field, the Component Manager searches all registered components for a component supplied by the manufacturer you specify. Note that the FindNextComponent function does not modify the contents of the component description record you supply. To retrieve detailed information about a component, you need to use the GetComponentInfo function to get the component description record for each returned component.

DESCRIPTION

The FindNextComponent function returns the component identifier of a component that meets the search criteria. FindNextComponent returns a function result of 0 when there are no more matching components.

SEE ALSO

Use the GetComponentInfo function, described on GetComponentInfo , to retrieve more information about a component. To open a component, use the OpenDefaultComponent or OpenComponent function, described on OpenDefaultComponent and OpenComponent , respectively. See The Component Description Record for information on the component description record.

See Listing 1 for an example of searching for a specific component.

CountComponents

Your application can use the CountComponents function to determine the number of registered components that meet your selection criteria. You specify the selection criteria in a component description record. The CountComponents function returns the number of components that meet those search criteria.

FUNCTION CountComponents (looking: ComponentDescription): LongInt;
looking
A component description record. Your application specifies the criteria for the component search in the fields of this record.
The Component Manager ignores fields in the component description record that are set to 0. For example, if you set all the fields to 0, the Component Manager returns the number of components registered in the system. Similarly, if you set all fields to 0 except for the componentManufacturer field, the Component Manager returns the number of registered components supplied by the manufacturer you specify.

DESCRIPTION

The CountComponents function returns a long integer containing the number of components that meet the specified search criteria.

SEE ALSO

See The Component Description Record for information on the component description record.

GetComponentListModSeed

The GetComponentListModSeed function allows you to determine if the list of registered components has changed. This function returns the value of the component registration seed number. By comparing this value to values previously returned by the this function, you can determine whether the list has changed. Your application may use this information to rebuild its internal component lists or to trigger other activity that is necessary whenever new components are available.

FUNCTION GetComponentListModSeed: LongInt;

DESCRIPTION

The GetComponentListModSeed function returns a long integer containing the component registration seed number. Each time the Component Manager registers or unregisters a component it generates a new, unique seed number.


© 1999 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next